#include<iostream> 
using namespace std;

typedef unsigned short u16; 

typedef struct {
	u16 R:5;
	u16 G:6;
	u16 B:5;
}RGB;
typedef struct {
	u16 reserve:1;
	u16 R:5;
	u16 G:5;
	u16 B:5;
}SRGB;

int main()
{
	unsigned int rgb32;
	unsigned short rgb16;
	typedef struct{
		unsigned short r;
		unsigned short g;
		unsigned short b;
	}RGB;
	RGB temp;
	rgb32=0xFF;
	cout<<"R G B"<<endl;
	while(cin>>temp.r>>temp.g>>temp.b)
	{
		rgb16=((temp.r>>3)<<11)|((temp.g>>2)<<5)|(temp.b>>3);
		cout<<hex<<rgb16<<endl;
	}

}
